'''
Created on 2012-10-1

@author: siloonuser
'''
import sys
from PySide.QtCore import *
from PySide.QtGui import *

from ui_SettingEnviromentVar import Ui_DialogEnviromentVarSetting
from AppMain import AppMain

class SettingEnviromentVarDialog(QWidget,Ui_DialogEnviromentVarSetting):
    def __init__(self, callback, parent=None):
        super(SettingEnviromentVarDialog, self).__init__()
        self.setupUi(self)
        self.textFileDir.setText(AppMain.CFG_FILE_DIR)
        self.txtJavaCmdPath.setText(AppMain.CFG_JAVA_CMD_PATH)
        
        self.callback = callback
    def accept(self):
        AppMain.CFG_FILE_DIR = self.textFileDir.text()
        AppMain.CFG_JAVA_CMD_PATH = self.txtJavaCmdPath.text()
        AppMain.saveCfgData()
        self.callback()
        self.close()
    def reject(self):
        self.close()
        